package string;

import java.util.Locale;

public class EqualsDemo {
    public static void main(String[] args) {
        String str1 = "Hello";
        String str2 = "Hello";
        System.out.println("str1：" + str1);
        System.out.println("str2：" + str2);
        System.out.println("str1 == str2：" + (str1 == str2));
        String str3 = new String("Hello");
        System.out.println("str3：" + str3);
        System.out.println("str1 == str3：" + (str1 == str3));//比较地址
        System.out.println("str1.equals(str3)：" + str1.equals(str3));//比较内容

        String code = "1a2B3c4D";
        String input = "1a2b3c4d";
        System.out.println("验证：" + code.equals(input));
        String code1 = code.toUpperCase();
        String input1 = input.toUpperCase();
        System.out.println("验证：" + code1.equals(input1));
        System.out.println("验证：" + code.equalsIgnoreCase(input));


    }
}
